package main.java.design.prototype;

import java.io.Serializable;

/**
 * <p>
 *     具体原型类，实现一个隔开自身的操作
 * </p>
 *
 * @author : wangdejian
 * @version 1.0
 * @date : 2020/6/10 22:54
 */
public class ShaunTheSheep implements Sheep {

    private String sheepName;

    private String sheepColor;




    @Override
    public Sheep createClone() {
        Sheep sheep = null;

        try {
            sheep = (Sheep)clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return sheep;
    }

    public String getSheepName() {
        return sheepName;
    }

    public void setSheepName(String sheepName) {
        this.sheepName = sheepName;
    }

    public String getSheepColor() {
        return sheepColor;
    }

    public void setSheepColor(String sheepColor) {
        this.sheepColor = sheepColor;
    }

    public ShaunTheSheep(String sheepName,
                         String sheepColor) {
        this.sheepName = sheepName;
        this.sheepColor = sheepColor;
    }

    @Override
    public String toString() {
        return "ShaunTheSheep{" +
                "sheepName='" + sheepName + '\'' +
                ", sheepColor='" + sheepColor + '\'' +
                '}';
    }
}
